/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package facades.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alvaro
 */
@Entity
@Table(name = "movement")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Movement.findAll", query = "SELECT m FROM Movement m")})
public class Movement implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idmovement")
    private Integer idmovement;
    @Size(max = 45)
    @Column(name = "operation")
    private String operation;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "money")
    private Float money;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Size(max = 45)
    @Column(name = "email")
    private String email;
    @Size(max = 45)
    @Column(name = "account")
    private String account;
    @Size(max = 45)
    @Column(name = "emailTO")
    private String emailTO;
    @Size(max = 45)
    @Column(name = "accountTO")
    private String accountTO;
    @Size(max = 200)
    @Column(name = "description")
    private String description;
    @Size(max = 45)
    @Column(name = "emailowner")
    private String emailowner;
    @JoinColumn(name = "user_iduser", referencedColumnName = "iduser")
    @ManyToOne
    private User userIduser;

    public Movement() {
    }

    public Movement(Integer idmovement) {
        this.idmovement = idmovement;
    }

    public Integer getIdmovement() {
        return idmovement;
    }

    public void setIdmovement(Integer idmovement) {
        this.idmovement = idmovement;
    }

    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public Float getMoney() {
        return money;
    }

    public void setMoney(Float money) {
        this.money = money;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getEmailTO() {
        return emailTO;
    }

    public void setEmailTO(String emailTO) {
        this.emailTO = emailTO;
    }

    public String getAccountTO() {
        return accountTO;
    }

    public void setAccountTO(String accountTO) {
        this.accountTO = accountTO;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getEmailowner() {
        return emailowner;
    }

    public void setEmailowner(String emailowner) {
        this.emailowner = emailowner;
    }

    public User getUserIduser() {
        return userIduser;
    }

    public void setUserIduser(User userIduser) {
        this.userIduser = userIduser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmovement != null ? idmovement.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Movement)) {
            return false;
        }
        Movement other = (Movement) object;
        if ((this.idmovement == null && other.idmovement != null) || (this.idmovement != null && !this.idmovement.equals(other.idmovement))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "facades.persistence.Movement[ idmovement=" + idmovement + " ]";
    }
    
}
